#include "Logger.h"


Logger::Logger(void)
	:m_Logger("RunningLog.log",std::fstream::out | std::ios_base::trunc)
{
}


Logger::~Logger(void)
{
	if(m_Logger.good())
		m_Logger.close();
}

Logger* Logger::Instance()
{
	static Logger* instance = NULL;
	if(!instance)
		instance = new Logger();
	return instance;
}

void Logger::LogString( const std::string& str )
{
	m_Logger<<str<<std::endl;
}

void Logger::LogD3DXCOLOR( const D3DXCOLOR& color )
{
	m_Logger<<color.r<<" "<<color.g<<" "<<color.b<<std::endl;
}

void Logger::Log( const D3DXVECTOR3& vec )
{
	m_Logger<<vec.x<<" "<<vec.y<<" "<<vec.z<<std::endl;
}

void Logger::Log( const std::string& str )
{
	m_Logger<<str<<std::endl;
}

void Logger::Log( const D3DXMATRIX& mat )
{
	for(int i=0;i<4;++i)
	{
		for(int j=0;j<4;++j)
		{
			m_Logger<<mat.m[i][j]<<" ";
		}
		m_Logger<<std::endl;
	}
}

void Logger::Log( const D3DXCOLOR& color )
{
	m_Logger<<color.r<<" "<<color.g<<" "<<color.b<<std::endl;
}

void Logger::Log( const BoundingBox& box )
{
	m_Logger<<"min point : ";
	Log(box.m_vec3Min);
	m_Logger<<"max point : ";
	Log(box.m_vec3Max);
}

void Logger::LogError( const std::string& str )
{
	m_Logger<<"Error : ";
	m_Logger<<str<<std::endl;
}

//void Logger::LogBoardToConsole( const ChessBoard& board )
//{
//	for(int i=RowBeginIndex ;i<ChessBoardSize-2 ;++i)
//	{
//		for(int j=ColBeginIndex ;j<ChessBoardSize-2 ;++j)
//		{
//			std::cout<<board.m_Board[i][j]<<" ";
//		}
//		std::cout<<std::endl;
//	}
//}

//void Logger::LogToConsole( const std::string& str )
//{
//	std::cout<<str<<std::endl;
//}
